﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MusicWorks.Web.Logic.Views.Models;
using WebFormsMvp.Web;
using MusicWorks.Web.Logic.Views;
using MusicWorks.Web.Properties;

namespace MusicWorks.Web.Controls
{
    public partial class ProductControl : MvpUserControl<ProductModel>, IProductView
    {
        public string ProductId { get { return Request["id"]; } }
        public string CatalogName { get { return Settings.Default.ProductCatalogName; } }

        public event EventHandler<AddToCartEventArgs> AddToCart;

        protected void AddToCartButton_OnClick(object sender, EventArgs e)
        {
            OnAddToCart(new AddToCartEventArgs(Convert.ToString(ProductId), Settings.Default.ShoppingBasketName));
        }

        protected virtual void OnAddToCart(AddToCartEventArgs addToCartEventArgs)
        {
            if (AddToCart != null) AddToCart(this, addToCartEventArgs);
        }
    }
}